home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / DDPLUS71.ZIP / DVAWARE.ASM < prev    next >
Assembly Source File  |  1995-03-23  |  3KB  |  91 lines

  1.                 Title  DVAWARE
  2. ; Routines courtesy of Quarterdeck Office Systems
  3. ; Modified for Turbo Assembler by Steven R. Lorenz 1992
  4. ;**************************************************************
  5.  
  6. CODE SEGMENT
  7.   ASSUME CS:CODE;ds:nothing
  8. MASM
  9.       PUBLIC  DV_AWARE_ON
  10.       PUBLIC  DV_BEGIN_CRITICAL  
  11.       PUBLIC  DV_END_CRITICAL
  12.  
  13. ; Returns in AH/AL in DESQview major/minor version numbers,
  14. ; and sets up the IN_DV variable for later use.
  15. ; Returns 0 in AX if DESQview isn't present.
  16.  
  17.   IN_DV   DB 1
  18.   DV_Aware_On PROC FAR
  19.       PUSH  AX            
  20.       PUSH  CX
  21.       PUSH  DX
  22.       MOV   CX,'DE'             ; Set CX to 4445H; DX to 5351H
  23.       MOV   DX,'SQ'             ; (an invalid date)
  24.       MOV   AX,2B01H            ; DOS' set date function
  25.       INT   21H                 ; Call DOS
  26.       CMP   AL,0FFH             ; Did DOS see this as invalid?
  27.       JE    NO_DESQVIEW         ; if yes, DESQview isn't there
  28.       MOV   AX,BX               ; AH=major version; AL=minor ver
  29.       MOV   CS:IN_DV,1          ; Set internal variable used by
  30.       JMP   SHORT DVGV_X        ; other routines
  31.  NO_DESQVIEW:
  32.       XOR    AX,AX              ; Return no DESQview (version 0)
  33.  DVGV_X:
  34.       POP    DX
  35.       POP    CX
  36.       POP    BX
  37.       RET
  38.  ENDP DV_Aware_On
  39. ;**************************************************************
  40.  
  41. ; This local routine takes a program interface function in BX,
  42. ; and makes that call to DV after switching onto a stack that
  43. ; DV provides for your program.
  44.  
  45.  API_CALL  PROC  NEAR
  46.       PUSH   AX
  47.       MOV    AX,101AH           ; The function to switch to DV's stack
  48.       INT    15H                ; DV's software interrupt
  49.       MOV    AX,BX              ; Move the desired function to AX
  50.       INT    15H                ; Make that call
  51.       MOV    AX,1025H           ; Function to switch off of DV's stack
  52.       INT    15H                ; Make that call
  53.       POP    AX
  54.       RET
  55.  ENDP API_CALL
  56.  
  57. ;**************************************************************
  58. ; This routine tells DV not to slice away from your program
  59. ; until you make a DV_END_CRITICAL call.
  60. ; NOTE - Then always make that DV_END_CRITICAL after this call.
  61. ; Takes no parameters and returns nothing.
  62.  
  63.  DV_BEGIN_CRITICAL  PROC  FAR
  64.       CMP    CS:IN_DV,1         ; Is DESQview present?
  65.       JNE    DVBC_X             ; If not, jump out of here
  66.       PUSH   BX                 ; Else make the begin critical call
  67.       MOV    BX,101BH           ; This is the DV function code
  68.       CALL   API_CALL           ; Do it
  69.       POP    BX
  70.  DVBC_x:  RET
  71.  ENDP DV_BEGIN_CRITICAL
  72. ;**************************************************************
  73.  
  74. ; This routine tells DV that it is all right to time slice away
  75. ; from your program again.
  76. ; Takes no parameters and returns nothing.
  77.  
  78.  DV_END_CRITICAL PROC FAR
  79.        CMP   CS:IN_DV,1         ; Is DESQview present?
  80.        JNE   DVEC_X             ; If not, jump out of here
  81.        PUSH  BX                 ; Else make the end critical call
  82.        MOV   BX,101CH           ; This is the DV function code
  83.        CALL  API_CALL           ; Do it
  84.        POP   BX
  85.  DVEC_X: RET
  86.  ENDP DV_END_CRITICAL
  87.  
  88. CODE ENDS
  89.  END
  90. ;**************************************************************
  91.